
public class TestStudent {
	public static void main(String[] args) {
		Student s1 = new Student();
		s1.name = "小李";
//		s1.classroom = "计算机";//static声明的变量是属于整个类的，不属于对象
		//虽然使用对象可以调用，但是读代码的时候会有歧义，所以会在eclipse中提出警告
		//在写代码的时候如果是静态变量，或者静态方法，一定要用类名调用
		Student.classroom = "计算机";
		
		Student s2 = new Student();
		s2.name = "小王";
		Student.classroom = "物联网";
		
		Student.classroom = "物理学";
		
		s1.talk();
		s2.talk();
	}
}

class Student {
	String name;
	static String classroom;
	
	public void talk() {
		System.out.println(name+","+classroom);
	}
}
